<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="6" :md="6" :sm="24" >
            <a-form-item label="任务发起人">
              <j-select-user-by-dep v-model="queryParam.creator"></j-select-user-by-dep>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="6" :md="6" :sm="24" >
            <a-form-item label="流程编码">
              <a-input v-model="queryParam.modelKey" placeholder="请输入流程编码"/>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="6" :md="6" :sm="24" >
            <a-form-item label="流程名称">
              <a-input v-model="queryParam.modelName" placeholder="请输入流程名称"/>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="6" :md="6" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button  type="primary" icon="search" @click="searchQuery">查询</a-button>
              <a-button type="primary" icon="reload" style="margin-left: 8px" @click="searchReset">重置</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>

    <!-- table区域-begin -->
    <div>
      <a-table
        size="middle"
        bordered
        row-key="id"
        :columns="columns"
        :data-source="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange"
      >
        <template slot="action" slot-scope="text, record">
            <a @click="detailClick(record)">查看审批</a>
        </template>
      </a-table>
    </div>
    <task-modal ref="taskModal" type="history" :taskData="taskData"></task-modal>
  </a-card>
</template>

<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import taskModal from './modal/TaskModal'
import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep'
export default {
  name: 'MyCcHisProcessList',
  components: {
    taskModal,
    JSelectUserByDep
  },
  mixins: [JeecgListMixin],
  data() {
    return {
      // 表头
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender: function(t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '业务标题',
          align: 'center',
          dataIndex: 'title'
        },
        {
          title: '流程编号',
          align: 'center',
          dataIndex: 'modelKey'
        },
        {
          title: '流程名称',
          align: 'center',
          dataIndex: 'modelName'
        },
        {
          title: '发起人',
          align: 'center',
          dataIndex: 'initiator'
        },
        {
          title: '办理人',
          align: 'center',
          dataIndex: 'createBy'
        },
        {
          title: '开始时间',
          align: 'center',
          dataIndex: 'startTime'
        },
        {
          title: '结束时间',
          align: 'center',
          dataIndex: 'endTime'
        },
        {
          title: '耗时',
          align: 'center',
          dataIndex: 'useTime'
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        list: '/activiti/duplicate/list'
      },
      taskData: {},
      excludeKeys: ['modelName', 'modelKey', 'creator']
    }
  },
  methods: {
    detailClick(record) { // 审批进度
      this.taskData = record
      this.$refs.taskModal.editModalVisible = true
    }
  }
}
</script>

<style lang="less">

</style>
